package com.yidiandao.business.ui.main.shoppingcart.chooseredpacket;

import android.app.Activity;
import android.content.Intent;

import com.yidiandao.business.R;
import com.yidiandao.business.base.BaseActivity;
import com.yidiandao.business.data.model.CouponModel;
import com.yidiandao.business.utils.ActivityUtils;

/**
 * 选择红包Activity.
 */
public class ChooseRedPacketActivity extends BaseActivity {

    private ChooseRedPacketFragment mChooseRedPacketFragment;

    public static void actionStart(Activity activity) {
        Intent intent = new Intent(activity, ChooseRedPacketActivity.class);
        activity.startActivity(intent);
    }

    @Override
    protected void initFragment() {
        mChooseRedPacketFragment = (ChooseRedPacketFragment)
                getSupportFragmentManager().findFragmentById(R.id.container_choose_red_packet);

        if (mChooseRedPacketFragment == null) {
            mChooseRedPacketFragment = ChooseRedPacketFragment.getInstance(getIntent().getExtras());
            ActivityUtils.addFragmentToActivity(getSupportFragmentManager(), mChooseRedPacketFragment, R.id.container_choose_red_packet);
        }
    }

    @Override
    protected void initPresenter() {
        new ChooseRedPacketPresenter(mChooseRedPacketFragment,new CouponModel());
    }

    @Override
    protected int getLayoutId() {
        return R.layout.activity_choose_red_packet;
    }
}
